#ifndef MFILEDEVICE_H
#define MFILEDEVICE_H

#include "miodevice.h"
#include "mdatetime.h"

#ifdef FILE_SYSTEM_FAT32

class MFileDevicePrivate;

class MFileDevice : public MIODevice
{
	public:
		struct Info
		{
			char name[256];
			MDateTime time;
			muint32 size;
			muint8 attr;
		};

	protected:
		explicit MFileDevice(MObject *parent = NONE);
		explicit MFileDevice(const MString &path, MObject *parent = NONE);
		virtual ~MFileDevice() = 0;

	public:
		virtual bool clear() = 0;

	public:
		bool update();
		static bool update(const MString &path);

		bool remove();
		static bool remove(const MString &path);

		bool rename(const MString &new_path);
		static bool rename(const MString &old_path, const MString &new_path);

		bool copy(const MString &new_path);
		static bool copy(const MString &old_path, const MString &new_path);

		bool move(const MString &new_path);
		static bool move(const MString &old_path, const MString &new_path);

	public:
		const Info stat() const;
		static const Info stat(const MString &path);

	protected:
		explicit MFileDevice(MFileDevicePrivate &d, MObject *parent = NONE);
		MFileDevice(MFileDevicePrivate &d, const MString &path, MObject *parent = NONE);

	private:
		M_DECLARE_PRIVATE(MFileDevice)
		M_DISABLE_COPY(MFileDevice)
};


#endif //FILE_SYSTEM_FAT32

#endif //MFILEDEVICE_H
